<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<script type="text/javascript">

$(document).ready(function(){

});

function updateInfo(hp){
// 	$("#lst").html(html);
	getEnc();
	location.href="./udtUsr.do?hp="+hp+"&enc="+$("#enc").val();
}

function getEnc(){
	if(window.hwInfo){
		$("#enc").val(window.hwInfo.getInfo());	
	}
}
//목록 가져오기
function submitData(){
	if($("#info").val()==""){
		$("#lst").html("<img alt='' src='/camping/1.jpg' style='width: 100%;'>");
	}else{
		getEnc();
		$.ajax({
			url: "./usrList.do",
			dataType: "json",
			data : {"hp" : $("#info").val(),enc:$("#enc").val() },
			success : function (json){
//	 			console.log(json);
//	 			alert(json.list.length);
				if(json.list.length==0){
					$("#lst").html("<li>데이터가 없습니다</li>");
				}else{
					var html= "";
					$.each(json.list, function (i) {
						
						html+= "<li><a href='javascript:updateInfo(\""+this.hp+"\")'>";
						html+="닉네임 : "+ this.nick+ ", 가입사이트 : "+this.con_site_nm+", 전화번호 : "+this.hp+", 등급 : "+this.user_type_nm+" 기타 : "+this.etc;
						html+= "</a></li>";
						$("#lst").html(html);
					});	
				}
				
			},
			error : function(error){
				seqChk = true;
				alert('접속지연이 발생했습니다. 몇분후에 다시 확인해주세요\n'+error);
			}
		});
	}
	
}
// <img alt="" src="/camping/1.jpg" style="width: 100%;">


</script>
<!-- <br> -->
<%-- ${map } --%>
<!-- <br> -->
<div style="width:100%;">
<table cellpadding="0" cellspacing="0" width="100%">
	<col width="98px" >
	<col width=""  >
	<col width="48px"  >
  <tr>
    <td style="height:53px; background-image: url('/camping/left.png')"></td>
    <td style="height:53px; background-image: url('/camping/center.png')">
    <input id="info" name="info" value="" type="tel" style="width:100%;height: 30px;border-width:0;" />
    <input id="enc" name="enc" value="" type="hidden"/>
    </td>
    <td onclick="submitData();" style="height:53px; background-image: url('/camping/right.png')"></td>
  </tr>
  <tr>
  	<td colspan="3" id="lst">
  		<img alt="" src="/camping/1.jpg" style="width: 100%;">
  	</td>
  </tr>
</table>
</div>





<button onclick="javascript:location.href='./intUsr.do';">등록</button>
